-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Lens] give data plugin control of filter extraction, injection, and migrations #120305
[Lens] give data plugin control of filter extraction, injection, and migrations #120305
Conversation
da9dc2a
to
7218e4f
Compare
@flash1293 I am currently injecting the What do you think about those options? |
@andrewctate Agree, statically exporting these helpers seems like the easiest approach. Similar to how the search namespace is exported here maybe: kibana/src/plugins/data/server/index.ts Line 95 in 4385ac4
@ppisljar @Dosant do you have any guidance here how it should work? |
[suggestion] statically import filter inject/extract
172956b
to
9ff5fa9
Compare
e9adaed
to
6ce57e3
Compare
…ts' of github.com:andrewctate/kibana into 114482/correctly-apply-filter-migrations-in-saved-objects
…y-apply-filter-migrations-in-saved-objects
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again and works fine, thanks! I would appreciate another look just to make sure - as discussed these changes are really important to get right
@elasticmachine merge upstream |
@alexwizp @stratoula Tim suggested one of you to take a look at the migrations in this PR. Would one of you be available to give it a review? |
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested various Lens charts with filter combinations created in v8 and migrated to v8.1. They seem to work fine.
I just have a question for the "Unsaved changes modal"
Let's say that I have an embedded lens chart. I dont change anything, I just select a different dataview from the left panel
For example here
I changed the index pattern dropdown from flights to ecommerce but I didn't make any change to the chart. Why do I see the modal?
I tested it in v8 and the modal doesn't appear (which makes more sense to me)
💚 Build Succeeded
Metrics [docs]Public APIs missing comments
Async chunks
Page load bundle
Unknown metric groupsAPI count
References to deprecated APIs
History
To update your PR or re-run it, just comment with: |
@mbondyra good find. I will look into how difficult it would be to exclude that particular setting from the state comparison. On the other hand, the selected data view is persisted in the saved object according to @flash1293 , so there's may also be argument for warning the user if they navigate away without saving. I'm not sure on what the user would expect. |
Do we? Even if it is not used at all? In my example above I just changed index pattern from the dropdown, the field list is updated but I haven't used any of them in my viz. I cant replicate it tbh. I checked the SO and there is no reference of the unused dataview. 🤔 |
@stratoula It's not used on the dashboard, but it's used in the editor to re-open the data view in the data panel the user had opened the last time. It's stored in the references as "current index pattern": I don't feel strongly about changing that and just not saving this piece of the state (it doesn't seem super relevant in the first place), but I would like to move it out of this PR if possible. |
@tomsonpl thanks for the review! @stratoula okay, I will merge as-is. Feel free to assign that issue to me! |
Summary
Resolves #114482
extract
/inject
functions instead of our own local stuffQuestion for core team: I duplicated the
mergeMigrationFunctionMaps
function to make it work for a similar typeSavedObjectMigrationMap
which passes an additioncontext
argument. See the duplicate function here. Any thoughts on how/if to unify these?How to Test
Saved Object Migrations
Dashboard with Embedded Lens Visualizations with Filters
standalone table with filters
standalone bar chart with filter
indexRefName
property. Instead, it should have anindex
property.migrated: true
property."Unsaved changes" Modal
Setup
Does NOT prompt if nothing has changed
Expected No "Unsaved changes" warning is shown
DOES prompt if something has changed
Expected: You should see "Unsaved changes" warning
Special case: datasource change
Expected: You should see "Unsaved changes" warning
Checklist
Risk Matrix
extractFilterReferences
and Data plugin'sextract
. Lens removesfilter.meta.value
since it wasn't persistable at some point.value
is no longer non-persistable.